<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.kylin.common.exception.*,com.kylin.common.dict.orm.Dict,com.kylin.module.shop.orm.*,com.kylin.module.user.orm.*"%>
<%@ include file="/common/include/taglibs.jsp"%>

<%@ include file="../_deco/managetop.jsp"%>
<br>
<table class="tl050804" cellspacing="0" cellpadding="0">
  <tr>
    <td width="280"  align="center" valign="top">
	<%@ include file="../_deco/manageLeft.jsp"%>
	</td>
    <td align="left" valign="top">
	<%
	//////////////////// 右侧 内容区  /////////////////////// start
	%>

	<%
		Company currCom = (Company) session.getAttribute(Constants.CURR_LANG_COMPANY);
	%>
	<table width="92%" cellspacing="0" cellpadding="0">
      <tr>
        <td height="30" class="ms02">&nbsp;&nbsp;<bean:message key="company.28"/></td>
        <td align="right">欢迎</td>
      </tr>
	   <tr>
              <td colspan="2" bgcolor="CDCDCD" height="1"></td>
             
	   </tr>
    </table>
      <br>
	  <mytag:MyActionMsg />
<form name="companyForm" action="/module/shop/company/companyManage.do" method="post" enctype="multipart/form-data">		
	<input type="hidden" name="CMD" value="doManage1"/>
	<input type="hidden" name="id" value="<%=currCom.getId() %>"/>
      <table width="90%"  border="0" cellspacing="0" cellpadding="0">
        <tr align="left">
				<td width="80" height="30"> <b><bean:message key="company.15"/>:</b> </td>
				<td> 
<%
    if(currCom.getName() != null && !currCom.getName().equals("")){
        out.println(currCom.getName());
    }else{
        out.println("<input type='text' name='name' >");
    }
%>				
				</td>
			</tr>
			<tr align="left">
				<td height="30"> <b><bean:message key="company.16"/>:</b> </td>
				<td>
					<%=UTool.getCountryName(currCom.getUser().getCountry(),sessionLocale)%>
				</td>
			</tr>
			<tr align="left">
				<td height="30"> <b><bean:message key="company.17"/>:</b> </td>
				<td>
					<%
					    if(currCom.getMainbusiness()==null || currCom.getMainbusiness().size() < 1){
					%>
						<mytag:select name="mainbusiness" notEmpty="true" multiple="true"  style="width:100px;"
                			size="3" dictName="<%=dict_mainBusiness%>"/>
					<%	
						}else{				    
							java.util.Iterator itr = currCom.getMainbusiness().iterator();
							while (itr.hasNext()) {
								CompanyInd ci = (CompanyInd) itr.next();
								out.println(ci.getIndustry() + "&nbsp;&nbsp;");
							}
						}
					%>
				</td>
			</tr>
			<tr align="left">
				<td height="30"> <b><bean:message key="company.18"/>:</b> </td>
				<td>
					<%
					    if(currCom.getMaincatproduct().size()<1){
			    			  List maincatproduct = new ArrayList();
			    			  try{
			    			      maincatproduct = MemObjFactory.getDict(dict_catProducts,sessionLocale.toString());
		    			          if(maincatproduct==null)
		    			              maincatproduct = new ArrayList();
		    			      }catch(SystemException e){
		    			        out.println(e);
		    			      }
			                  StringBuffer sb1 = new StringBuffer();
			                  StringBuffer sb2 = new StringBuffer();
			                  for(int i=0;i<maincatproduct.size();i++){
			                  	  Dict dict = (Dict)maincatproduct.get(i);
			                  	  String dictName = dict.getName().replaceAll("'", "`");
			                      if(dict.getParent() == null){
			                          sb1.append("\n<option value='").append(dict.getId()).append("'>");
			                          sb1.append(dictName).append("</option>");
			                      }else{
			                      	 if(sb2.length() > 1)
			                      	     sb2.append(",");
			                         sb2.append("\n  new SubSelectObj('").append(dict.getId()).append("','");
			                         sb2.append(dict.getParent().getId()).append("','");
			                         sb2.append(dictName).append("')");
			                      }
			                  }
              		%>
              
				              <br><select name="catproductparent" id="parentSelect" 
				                  style="width:100px;" onchange="setSub(this.value)">
				              	<%=sb1%>
				              </select><br>
<select name="maincatproduct" id="subSelect" size="4" style="width:100px;" multiple="true">
             </select>
       <script src="/script/kylin.js"></script>
       <script>
		var subArray= new Array(<%=sb2%>); 
		function setSub(pid){
			var subSelcet = document.getElementById("subSelect");
			setSubSelect(subArray,subSelcet,pid);
		}
		setSub(document.getElementById("parentSelect").value);
       </script>				              
				              
				              
				              
					<%					    
					    }else{
							java.util.Iterator itrCatp = currCom.getMaincatproduct().iterator();
							while (itrCatp.hasNext()) {
								CompanyCat cat = (CompanyCat) itrCatp.next();
								out.println(cat.getCatproduct() + "&nbsp;&nbsp;");
							}
						}
					%>
					
					
				</td>
			</tr>
			<tr align="left">
				<td height="30"> <b><bean:message key="base.28"/>:</b> </td>
				<td>
					<input name="address" type="text" value="<%=JspHelper.checkNull(currCom.getAddress())%>" size="40">
				</td>
			</tr>
			<tr align="left">
				<td height="30"> <b><bean:message key="base.22"/>:</b> </td>
				<td>
					<input name="postcode" type="text" value="<%=JspHelper.checkNull(currCom.getPostcode())%>" size="20">
				</td>
			</tr>
			<tr align="left">
				<td height="30"> <b><bean:message key="base.26"/>:</b> </td>
				<td>
					<input name="contact" type="text"
						value="<%=JspHelper.checkNull(currCom.getContact())%>" size="20">
				</td>
			</tr>
			<tr align="left">
				<td height="30"> <b><bean:message key="base.05"/>:</b> </td>
				<td>
					<input name="phoneCountry" type="text"
						value="<%=JspHelper.checkNull(currCom.getPhoneCountry())%>" size="10">
					-
					<input name="phoneArea" type="text" value="<%=JspHelper.checkNull(currCom.getPhoneArea())%>" size="10">
					-
					<input name="phone" type="text" value="<%=JspHelper.checkNull(currCom.getPhone())%>" size="10">
				</td>
			</tr>
			<tr align="left">
				<td height="30"> <b><bean:message key="base.06"/>：</b> </td>
				<td>
					<input name="faxCountry" type="text" value="<%=JspHelper.checkNull(currCom.getFaxCountry())%>" size="10">
					-
					<input name="faxArea" type="text" value="<%=JspHelper.checkNull(currCom.getFaxArea())%>" size="10">
					-
					<input name="fax" type="text" value="<%=JspHelper.checkNull(currCom.getFax())%>" size="10">
				</td>
			</tr>
			<tr align="left">
				<td height="30"> <b><bean:message key="base.07"/>:</b> </td>
				<td>
					<input name="email" type="text" value="<%=JspHelper.checkNull(currCom.getEmail())%>" size="40">
				</td>
			</tr>
			<tr align="left">
				<td> <b><bean:message key="company.03"/>：</b> </td>
				<td>
					<textarea name="companyIntro" cols="50" rows="8"><%=JspHelper.checkNull(currCom.getCompanyIntro())%></textarea>
				</td>
			</tr>
			<tr align="left">
				<td height="30"> <b><bean:message key="company.26"/>：</b> </td>
				<td>
					<input type="file" name="logo" size="40">
				</td>
			</tr>
			<tr align="left">
				<td height="30"> <b><bean:message key="company.27"/>：</b> </td>
				<td>
					<input type="file" name="adImg" size="40">
				</td>
			</tr>
			<tr align="center">
				<td height="50" colspan="2">
					<input class="rinput" type="submit" name="Submit" value="<bean:message key="base.70"/>">
				</td>
			</tr>
      </table>
      </form>
			<%
			////////////////////右侧 内容区  /////////////////////// end
			%>
    </td>
  </tr>
</table>


